package com.jjz.id.config.properties;

import com.jjz.id.common.enums.PasswordStrength;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.time.Duration;

/**
 * @author ZJL
 * @create 2025-05-28-9:43
 */
@Component
@ConfigurationProperties(
        prefix = "jue.authorization"
)
@Getter
@Setter
public class JueAuthorizationProperties {
    public static final String PREFIX = "jue.authorization";
    private String issuer;
    private String systemName = "authorization-server-jue";
    private String copyright = "default copyright@2025";
    private Boolean registerEnabled = true;
    private Duration passwordResetTokenExpiration = Duration.ofDays(7300L);
    private Jks jks;
    private PasswordStrength passwordStrength;
    private String passwordEncoder;

    public JueAuthorizationProperties() {
        this.passwordStrength = PasswordStrength.WEAK;
        this.passwordEncoder = "bcrypt";
    }
    public static class Jks {
        private String path;
        private String alias;
        private String password;
        public String getPath() {
            return this.path;
        }

        public Jks setPath(String path) {
            this.path = path;
            return this;
        }

        public String getAlias() {
            return this.alias;
        }

        public Jks setAlias(String alias) {
            this.alias = alias;
            return this;
        }

        public String getPassword() {
            return this.password;
        }

        public Jks setPassword(String password) {
            this.password = password;
            return this;
        }
    }

}
